<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>修改地址</title>
		<link rel="stylesheet" href="__AGENT__/css/css.css" />
		<script type="text/javascript" src="__PUBLIC__/static/js/jquery.min.js"></script>
		<link rel="stylesheet" href="__PUBLIC__/static/layui/css/layui.css">
		<script src="__PUBLIC__/static/layui/layui.js"></script>
	</head>

	<body>
		<form id="my_form" style="margin-bottom: 100px;" class="layui-form update_form" action="{:url('shop/add_edit')}" method="post">
			<div class="layui-form-item">
				<label class="layui-form-label">店铺名称</label>
				<div class="layui-input-block update_shurk">
					<input type="text" name="name" lay-verify="goods_no" value="{$res[0]['name']|default='0'}" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">*店铺地址</label>
				<div class="layui-input-block update_shurk">
					<input type="text" name="address" lay-verify="required" value="{$res[0]['address']|default='0'}" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">*手机号码</label>
				<div class="layui-input-block update_shurk">
					<input type="text" name="mobile" lay-verify="required" value="{$res[0]['mobile']|default='0'}" autocomplete="off" class="layui-input">
				</div>
			</div>

			<div class="layui-form-item update_btnbox">
				<div class="layui-input-block">
					<input type="hidden" name="id" value="{$res[0]['id']}">
					<button id='change_but' class="layui-btn" lay-submit lay-filter="demo1">立即提交</button>
					<button type="reset" class="layui-btn layui-btn-primary">重置</button>
				</div>
			</div>
		</form>
	</body>

</html>
{block name='script'}
<script type="text/javascript" src="__PUBLIC__/static/js/image.zip.js"></script>
<script type="text/javascript" src="/public/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="/public/ueditor/ueditor.all.js"></script>

{/block}
<script>
	//提交表单
	function set_content() {
		$.ajax({
			type: "post",
			url: "{:url('shop/dz_edit')}",
			data: $('#my_form').serialize(), //表单数据
			success: function(data) {
				if(data.code == 1) {
					layer.msg('修改成功', {
						icon: 1,
						time: 1500 //2秒关闭（如果不配置，默认是3秒）

					}, function() {
						window.parent.location.reload();
						var index = parent.layer.getFrameIndex(window.name); //获取窗口索引  
						parent.layer.close(index);
					});
				} else {
					layer.msg('修改失败'); //保存成功提示
				}
			},
			error: function(data) {
				var a = data;
			}
		});

	}
	layui.use(['form'], function() {
		var $ = layui.jquery,
			form = layui.form;
		//监听提交
		form.on('submit(demo1)', function(data) {
			$('#change_but').addClass("layui-btn-disabled");
			set_content();
			return false;
		});
	});
</script>